﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Geometry
{
    public class Point2D : Point, IPoint,IColor
    {
        public double Y { get; set; }


        public double Distance
        {
            get
            {
                return Math.Sqrt(X * X + Y * Y);
            }
        }

        public void Move(double dx, double dy)
        {
            base.Move(dx);
            Y += dy;

        }

        public override void Reset()
        {
            base.Reset();
            Y = 0;
        }
        public double DistanceFrom(double x, double y)
        {
            double dx = X - x;
            double dy = Y - y;
            return Math.Sqrt(dx * dx + dy * dy);
        }
        public double DistanceFrom(Point2D p)
        {
            return DistanceFrom(p.X,p.Y);
        }
        public override string ToString()
        {
            return string.Format("{0},{1}",X, Y );
        }

        public Color Color { get; set;}
       
    }
}
